var WapSiteUrl = window.location.protocol + "//" + window.location.host + "/?s="; //"http://sunflower.jhmis.net/wap";
//axios请求封装
function request(url, data) {
    return new Promise(function(resolve, reject) {
        axios
            .post(WapSiteUrl + url, data, {})
            .then((response) => {
                if (response.status === 200) {
                    resolve(response.data)
                }
            })
            .catch(function(error) {
                // 请求失败处理
                console.log("error")
                alert(error)
            })
    })
}
//获取地址的参数
function getQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); // [^]字符类取反
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return r[2];
    return '';
}

/**
 * 动态加载css文件
 * @param css_filename css文件路径
 */
function loadCss(css_filename) {
    var link = document.createElement('link');
    link.setAttribute('type', 'text/css');
    link.setAttribute('href', css_filename);
    link.setAttribute('href', css_filename);
    link.setAttribute('rel', 'stylesheet');
    var css_id = document.getElementById('auto_css_id');
    if (css_id) {
        document.getElementsByTagName('head')[0].removeChild(css_id);
    }
    document.getElementsByTagName('head')[0].appendChild(link);
}
/**
 * 动态加载js文件
 * @param script_filename js文件路径
 */
function loadJs(script_filename) {
    var script = document.createElement('script');
    script.setAttribute('type', 'text/javascript');
    script.setAttribute('src', script_filename);
    script.setAttribute('id', 'auto_script_id');
    var script_id = document.getElementById('auto_script_id');
    if (script_id) {
        document.getElementsByTagName('head')[0].removeChild(script_id);
    }
    document.getElementsByTagName('head')[0].appendChild(script);
}
// end